package com.statistics.controller;

import com.alibaba.fastjson2.JSONObject;
import com.common.annotation.Anonymous;
import com.common.core.domain.AjaxResult;
import com.statistics.service.VisualStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 可视化统计Controller
 *
 * @author chenyy
 * &#064;date 2025/3/4 16:57
 */
@Api(tags = "可视化统计")
@Anonymous
@RestController
@RequestMapping("/visual/statistics")
public class VisualStatisticsController {

    @Resource
    private VisualStatisticsService visualStatisticsService;

    @GetMapping("/zxStatistics")
    @ApiOperation(value = "1-纵向项目统计", notes = "返回年度项目量和历史项目量")
    public AjaxResult getZxStatistics() {
        JSONObject zxStatistics = visualStatisticsService.getZxStatistics();
        return AjaxResult.success(zxStatistics);
    }

    @GetMapping("/hxStatistics")
    @ApiOperation(value = "2-横向项目统计", notes = "返回年度项目量和历史项目量")
    public AjaxResult getHxStatistics() {
        JSONObject hxStatistics = visualStatisticsService.getHxStatistics();
        return AjaxResult.success(hxStatistics);
    }

    @GetMapping("/achieveStats")
    @ApiOperation(value = "3-科研成果统计", notes = "返回年度成果量和历史成果量")
    public AjaxResult getAchieveStats() {
        JSONObject achieveStats = visualStatisticsService.getAchieveStats();
        return AjaxResult.success(achieveStats);
    }

    @GetMapping("/acadAchieveStats")
    @ApiOperation(value = "4-科研学术成果统计", notes = "返回年度学术成果量和历史学术成果量")
    public AjaxResult getAcadAchieveStats() {
        JSONObject acadAchieveStats = visualStatisticsService.getAcadAchieveStats();
        return AjaxResult.success(acadAchieveStats);
    }

    @GetMapping("/totalResearchers")
    @ApiOperation(value = "5-科研人员统计", notes = "返回科研人员数量")
    public AjaxResult getTotalResearchers() {
        JSONObject totalResearchers = visualStatisticsService.getTotalResearchers();
        return AjaxResult.success(totalResearchers);
    }

    @GetMapping("/fiveYProjectsStats")
    @ApiOperation(value = "6-近五年度学校项目量统计", notes = "近五年度纵向，横向，校级项目量统计")
    public AjaxResult getFiveYProjectsStats() {
        List<JSONObject> fiveYProjectsStats = visualStatisticsService.getFiveYProjectsStats();
        return AjaxResult.success(fiveYProjectsStats);
    }

    @GetMapping("/researchFundingTop5")
    @ApiOperation(value = "7-本年度学院科研立项经费TOP5", notes = "本年度学院科研立项经费TOP5 [项目总经费,到账经费]")
    public AjaxResult getTop5ResearchFunding() {
        List<JSONObject> researchFundingTop5 = visualStatisticsService.getResearchFundingTop5();
        return AjaxResult.success(researchFundingTop5);
    }

    @GetMapping("/fiveYPaperStats")
    @ApiOperation(value = "8-近五年论文发表", notes = "近五年论文发表")
    public AjaxResult get5yPaperStats() {
        List<JSONObject> fiveYPaperStats = visualStatisticsService.getFiveYPaperStats();
        return AjaxResult.success(fiveYPaperStats);
    }

    @GetMapping("/projectLevelStats")
    @ApiOperation(value = "9-本年度学校按项目级别的立项情况", notes = "本年度学校按项目级别的立项情况 [国家级 部级 省级 地市级 校级（纵校+校级）横向课题(横向项目)]")
    public AjaxResult getProjectLevelStats() {
        JSONObject projectLevelStats = visualStatisticsService.getProjectLevelStats();
        return AjaxResult.success(projectLevelStats);
    }

    @GetMapping("/projectExpenditure")
    @ApiOperation(value = "10-本年度项目经费", notes = "本年度项目经费 [纵,横,校]")
    public AjaxResult getProjectExpenditure() {
        JSONObject projectExpenditure = visualStatisticsService.getProjectExpenditure();
        return AjaxResult.success(projectExpenditure);
    }

    @GetMapping("/projectFundsReceived")
    @ApiOperation(value = "11-本年度到账经费", notes = "本年度到账经费 [纵,横,校]")
    public AjaxResult getProjectFundsReceived() {
        JSONObject projectFundsReceived = visualStatisticsService.getProjectFundsReceived();
        return AjaxResult.success(projectFundsReceived);
    }

    @GetMapping("/fiveYPatentStats")
    @ApiOperation(value = "12-近五年专利发表", notes = "近五年专利发表")
    public AjaxResult get5yPatentStats() {
        List<JSONObject> fiveYPatentStats = visualStatisticsService.getFiveYPatentStats();
        return AjaxResult.success(fiveYPatentStats);
    }

    @GetMapping("/unitAchievementStatsTop5")
    @ApiOperation(value = "13-本年度学院成果TOP5", notes = "本年度学院成果TOP5")
    public AjaxResult getUnitAchievementStats() {
        List<JSONObject> unitAchievementStatsTop5 = visualStatisticsService.getUnitAchievementStatsTop5();
        return AjaxResult.success(unitAchievementStatsTop5);
    }

    @GetMapping("/fiveYTotalAchievement")
    @ApiOperation(value = "14-近五年成果数量", notes = "近五年成果数量")
    public AjaxResult get5yTotalAchievement() {
        List<JSONObject> fiveYTotalAchievement = visualStatisticsService.getFiveYTotalAchievement();
        return AjaxResult.success(fiveYTotalAchievement);
    }

    @GetMapping("/fiveYHonorStats")
    @ApiOperation(value = "15-近五年获奖情况", notes = "近五年获奖情况")
    public AjaxResult get5yHonorStats() {
        List<JSONObject> fiveYHonorStats = visualStatisticsService.getFiveYHonorStats();
        return AjaxResult.success(fiveYHonorStats);
    }



}